package main

import "fmt"

// Author : CSR丶WARRIOR
// Time ： 2020/10/14  10:23
// TOOLS : GoLand
// FILENAME : Bubble Sort.go
// STATEMENT: 冒泡排序

func main() {
	s := []int{7, 9, 11, 1, 3, 4}
	bubbleSort(s)
	fmt.Println(s) //[1 3 4 7 9 11]
}

func bubbleSort(s []int) {
	for i := 0; i < len(s); i++ {
		for j := 0; j < len(s)-i-1; j++ {
			if s[j] > s[j+1] {
				s[j], s[j+1] = s[j+1], s[j]
			}
		}
	}
}
